#include "SLineEdit.h"
#include <QMouseEvent>

SLineEdit::SLineEdit(const QString& txt, QWidget* parent /*= nullptr*/)
	:QLineEdit(txt, parent)
{

}

void SLineEdit::focusInEvent(QFocusEvent* e)
{
	QLineEdit::focusInEvent(e);
	if (m_selectAllWhenFocus)
		selectAll();
}

void SLineEdit::mousePressEvent(QMouseEvent* e)
{
	QLineEdit::mousePressEvent(e);
	if (m_selectAllWhenFocus && e->button() == Qt::LeftButton)
		selectAll();
}
